From cd697bb2e3dec998b559ac8db2e505c0f4172953 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sun, 25 May 2008 15:16:52 +0000 Subject: [PATCH] Enhanced pango attribute tests, Added tests for requires tag handling. * tests/buildertest.c: Enhanced pango attribute tests, Added tests for requires tag handling. svn path=/trunk/; revision=20154 --- ChangeLog | 3 +++ tests/buildertest.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/ChangeLog b/ChangeLog index a7aa9544f8..3eae2e5698 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ * gtk/docs/reference/gtk/tmpl/gtkbuilder.sgml: Added documentation for the added xml tags to the ui description. + * tests/buildertest.c: Enhanced pango attribute tests, Added tests + for requires tag handling. + 2008-05-25 Richard Hult * gtk/gtkdnd-quartz.c: (gtk_drag_drop_finished): Run diff --git a/tests/buildertest.c b/tests/buildertest.c index b3214574ef..601a5f5bea 100644 --- a/tests/buildertest.c +++ b/tests/buildertest.c @@ -2084,6 +2084,8 @@ test_pango_attributes (void) gtk_builder_add_from_string (builder, err_buffer1, -1, &error); label = gtk_builder_get_object (builder, "label1"); g_assert (error); + g_assert (error->domain == GTK_BUILDER_ERROR); + g_assert (error->code == GTK_BUILDER_ERROR_MISSING_ATTRIBUTE); g_object_unref (builder); g_error_free (error); error = NULL; @@ -2091,12 +2093,38 @@ test_pango_attributes (void) builder = gtk_builder_new (); gtk_builder_add_from_string (builder, err_buffer2, -1, &error); label = gtk_builder_get_object (builder, "label1"); + g_assert (error); + g_assert (error->domain == GTK_BUILDER_ERROR); + g_assert (error->code == GTK_BUILDER_ERROR_INVALID_ATTRIBUTE); g_object_unref (builder); g_error_free (error); } + +static void +test_requires (void) +{ + GtkBuilder *builder; + GError *error = NULL; + gchar *buffer; + const gchar buffer_fmt[] = + "" + " " + ""; + + buffer = g_strdup_printf (buffer_fmt, GTK_MAJOR_VERSION, GTK_MINOR_VERSION + 1); + builder = gtk_builder_new (); + gtk_builder_add_from_string (builder, buffer, -1, &error); + g_assert (error); + g_assert (error->domain == GTK_BUILDER_ERROR); + g_assert (error->code == GTK_BUILDER_ERROR_VERSION_MISMATCH); + g_object_unref (builder); + g_error_free (error); +} + + static void test_file (const gchar *filename) { @@ -2180,6 +2208,7 @@ main (int argc, char **argv) g_test_add_func ("/Builder/Window", test_window); g_test_add_func ("/Builder/IconFactory", test_icon_factory); g_test_add_func ("/Builder/PangoAttributes", test_pango_attributes); + g_test_add_func ("/Builder/Requires", test_requires); return g_test_run(); } -- 2.30.2